# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.FirebaseHosting.V1beta1.Model.Certificate do
  @moduledoc """
  An SSL certificate used to provide end-to-end encryption for requests against your domain name. A `Certificate` can be an actual SSL certificate or, for newly-created custom domains, Hosting's intent to create one.

  ## Attributes

  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The certificate's creation time. For `TEMPORARY` certs this is the time Hosting first generated challenges for your domain name. For all other cert types, it's the time the actual cert was created.
  *   `expireTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The certificate's expiration time. After this time, the cert can no longer be used to provide secure communication between Hosting and your site's visitors.
  *   `issues` (*type:* `list(GoogleApi.FirebaseHosting.V1beta1.Model.Status.t)`, *default:* `nil`) - Output only. A set of errors Hosting encountered when attempting to create a cert for your domain name. Resolve these issues to ensure Hosting is able to provide secure communication with your site's visitors.
  *   `state` (*type:* `String.t`, *default:* `nil`) - Output only. The state of the certificate. Only the `CERT_ACTIVE` and `CERT_EXPIRING_SOON` states provide SSL coverage for a domain name. If the state is `PROPAGATING` and Hosting had an active cert for the domain name before, that formerly-active cert provides SSL coverage for the domain name until the current cert propagates.
  *   `type` (*type:* `String.t`, *default:* `nil`) - Output only. The certificate's type.
  *   `verification` (*type:* `GoogleApi.FirebaseHosting.V1beta1.Model.CertVerification.t`, *default:* `nil`) - Output only. A set of ACME challenges you can add to your DNS records or existing, non-Hosting hosting provider to allow Hosting to create an SSL certificate for your domain name before you point traffic toward hosting. You can use thse challenges as part of a zero downtime transition from your old provider to Hosting.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :createTime => DateTime.t() | nil,
          :expireTime => DateTime.t() | nil,
          :issues => list(GoogleApi.FirebaseHosting.V1beta1.Model.Status.t()) | nil,
          :state => String.t() | nil,
          :type => String.t() | nil,
          :verification => GoogleApi.FirebaseHosting.V1beta1.Model.CertVerification.t() | nil
        }

  field(:createTime, as: DateTime)
  field(:expireTime, as: DateTime)
  field(:issues, as: GoogleApi.FirebaseHosting.V1beta1.Model.Status, type: :list)
  field(:state)
  field(:type)
  field(:verification, as: GoogleApi.FirebaseHosting.V1beta1.Model.CertVerification)
end

defimpl Poison.Decoder, for: GoogleApi.FirebaseHosting.V1beta1.Model.Certificate do
  def decode(value, options) do
    GoogleApi.FirebaseHosting.V1beta1.Model.Certificate.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.FirebaseHosting.V1beta1.Model.Certificate do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
